package ace.module.common.core.impl.service.impl;

import ace.cmp.security.core.impl.util.AuthorizationUtils;
import ace.module.common.core.impl.properties.ModuleCommonSecurityProperties;
import ace.module.common.core.impl.service.BasePropertiesService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 基础配置服务类.
 * @author Caspar
 *
 */
@AllArgsConstructor
@Component
public class BasePropertiesServiceImpl implements BasePropertiesService {

  private ModuleCommonSecurityProperties moduleCommonSecurityProperties;

  /**
   * 获取管理平台的oauth2客户端 authorization.
   *
   * @return 管理平台的oauth2客户端 authorization
   */
  public String getAdminOauth2ClientBasicAuthorization() {
    String clientId = moduleCommonSecurityProperties.getOauth2AdminClientId();
    String clientSecret = moduleCommonSecurityProperties.getOauth2AdminClientSecret();
    return AuthorizationUtils.getBasicAuthorization(clientId, clientSecret);
  }
}
